
    $("#btn").onclick = function(){
        //获取表单数据
        let pro_name = $("#pro_name").value;
        let pro_price = $("#pro_price").value;
        let pro_imgpath = $("#pro_imgpath").value;
        let pro_color = $("#pro_color").value;
        let pro_size = $("#pro_size").value;
        let pro_num = $("#pro_num").value;
        let pro_status = $("#pro_status").value;

        //创建xhr对象
        let xhr = new XMLHttpRequest();

        //实现open方法
        xhr.open("get","./api/add_prodata.php?pro_name="+pro_name+"&pro_price="+pro_price+"&pro_imgpath="+pro_imgpath+"&pro_color="+pro_color+"&pro_size="+pro_size+"&pro_num="+pro_num+"&pro_status="+pro_status);

        //发送请求
        xhr.send();

        //设置监听状态
        xhr.onreadystatechange = function(){
            if( xhr.readyState === 4 && xhr.status === 200 ){
                console.log( xhr.responseText );
            }
        }

        //刷新表单
        $("#oForm").reset();
    }

    $("#btn1").onclick = function(){
        window.location.href = "./zhuce.html";
    }




